#pragma once
#include <iostream>
#include <string>
#include <vector>

class String_API
{
public:
    static int string_split(const std::string &src, const std::string &sep, std::vector<std::string> &ret)
    {
        int pos = 0, index = 0;
        while (index < src.size())
        {
            pos = src.find(sep, index);
            if (pos == std::string::npos)
            {
                ret.push_back(src.substr(index));
                break;
            }

            if (pos == index)
            {
                index += sep.size();
                continue;
            }
            ret.push_back(src.substr(index, pos - index));
            index = pos + sep.size();
        }

        return ret.size();
    }
};